<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		
		<script type="text/javascript">
			
			var i=1000;
			var j=0;
			while(i<=5000){
				++j;
				i=(1+0.05)*i;

			}
			
			console.log("一共需要"+j+"年,"+"此时存款所得："+i+"元");
		</script>
	</head>
	<body>
	</body>
</html>
